import { rolelist } from '@/request/api'
export default{
    state:{
        roleList:[]
    },
    mutations:{
        mutation_roleList(state,payload){
            state.roleList = payload
        }
    },
    // 获取数据
    getters:{
        get_roleList(state){
            return state.roleList
        }
    },
    // 异步操作，请求数据
    actions:{
        async action_roleList({commit},payload){
            try{
                let  res = await rolelist();
                if(res.code==200){
                    console.log(res);
                    commit('mutation_roleList',res.list)
                }
            }catch(err){
                console.log(err);
            }
        }
    },
    namespaced:true
}